#include <iostream>
#include "Thread.hpp"
#include "Log.hpp"
#include "BlockQueue.hpp"
#include <unistd.h>
#include <vector>
#include <time.h>
#include <sys/types.h>
using namespace ThreadMoudle;
using namespace LogMoudule;


using func_t = std::function<void()>;
const int N = 20;


int gap = 20;
const int gcap = 5;
const int g_num = 10;

int data = 10;

void Log()
{
    while(true)
    {
        std::stringstream ss;
        for(int i = 1; i <= rand() % 30 ; ++i)ss<<' ';

        ss<<"Ciallo～(∠・ω ∠)⌒☆";
        LOG(LogLevel::DEBUG)<<ss.str();
        sleep(1);
    }
}


int main()
{
    std::vector<Thread> threads;
    // std::shared_ptr<BlockQueueMoudle::Blockqueue<func_t>> bq 
    // = std::make_shared<BlockQueueMoudle::Blockqueue<func_t>>();


    // LOG(LogLevel::DEBUG)<<"ciallo "<<1<<"\n";

    for (int i = 1; i <= g_num; ++i)
        threads.emplace_back(Log);



    for (auto &t : threads)
        t.Start();
    for (auto &t : threads)
    {
        int n = t.Join();
        // std::cout << "join " << t.Name() << " = " << n << std::endl;
    }

    return 0;
}
